<div class="mask-box">
  <%= form_for(@check_in, :url => private_check_in_admin_course_weeks_path, method: :post, remote:true)  do |f|%>
    <div class="mask-head">
      <h4>学员预约</h4>
      <span></span>
    </div>
    <div class="mask-con">
      <div class="mask-marc">
        <ul>
          <li>
            <span>选择学员:</span>
            <input type="" name="appointment_record[student_id]" id="student_id">
            <div class="single-box">
              <div class="single-downbtn">
                <span>学员列表</span> 
                <em></em>
              </div>
              <div class="single-dropdown">
                <em></em>
                <input type="text" placeholder="搜索">
                <ul>
                  <% @students.each do |stu| %>
                    <li data_id="<%= stu.id %>"><%= stu.name %></li>
                  <%end%>
                </ul>
              </div>
            </div>
          </li>
          <li>
            <span>选择课程:</span>
            <em><%= @course.course_info.name %></em>
          </li>
          <li>
            <span>课程导师:</span>
            <em><%= @course.course_info.teacher.name %></em>
          </li>
          <li>
            <span>上课教室:</span>
            <em><%= @course.course_info.room.room_name %></em>
          </li>
          <li>
            <span>上课时间:</span>
            <em><%= @course.course_time.strftime("%Y-%m-%d %H:%M") %></em>
          </li>
        </ul>
      </div>
    </div>
    <%= f.hidden_field :course_id %>
    <div ><%= f.submit "确认签到", :class => "mask-confirm" %></div>
  <%end%>
</div>
<script type="text/javascript" language="javascript" charset="utf-8">
$(".single-downbtn").on("click", function() {
  if ($(this).next(".single-dropdown").hasClass("menuopen")) {
    $(this).next(".single-dropdown").removeClass("menuopen");
  } else {
    $(this).next(".single-dropdown").addClass("menuopen");
    $(this).parent().hover(function() {

    }, function() {
      $(this).children(".single-dropdown").removeClass("menuopen");
    });
    $(".menuopen li").on("click", function() {
      $(this).parent().parent().removeClass("menuopen");
      $(this).parent().parent().parent().find("span").text($(this).text());
      $(this).parent().parent().find("input").val("");
      $(".single-dropdown li").removeClass("mul-hide");
      $("#student_id").val($(this).attr("data_id"));
    });
  };
});
</script>
